<!DOCTYPE html>
<html>
<script>
</script>
<head>
<?php
session_start();
$totall=$_SESSION['total_number'];

if($totall>=3)
{
$uName=$_SESSION['uName'];
$password=$_SESSION['password'];
$username=$_SESSION['username'];

require("include/connect.php"); 

$sql="select firstName,mobileno,area,street,jadda,houseno,block,delivery_direction from customer where emailid='$username' and password='$password'";
$res=mysqli_query($con,$sql);
$result=mysqli_fetch_array($res);

$firstName=$result['firstName'];
$mobile=$result['mobileno'];
$area=$result['area'];
$street=$result['street'];
$jadda=$result['jadda'];
$houseno=$result['houseno'];
$block=$result['block'];
$landmark=$result['delivery_direction'];
?>


    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>BootCommerce Demo</title>    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="BootCommerce is an E-commerce solution based on twitter bootstrap,perfect for any kind of shops.A complete Control Panel to manage Products, Categories, Orders,Clients and many system options">
    <meta name="keywords" content="e-commerce,ecommerce,bootstrap,twitter shop,shop,online sell,envato,codecanyon,template shop">
    <meta name="robots" content="INDEX,FOLLOW">
    <meta name="viewport" content="user-scalable=no,initial-scale=1.0, maximum-scale=1.0 width=device-width">
    <!-- Styles -->
    	 
	<link href="BootCommerce%20Demo_files/bootstrap.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/bootstrap_extensions.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/addons.css" rel="stylesheet">   
	<link href="BootCommerce%20Demo_files/bootstrap-responsive.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/bootstrap_responsive_extensions.css" rel="stylesheet">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="include/js/html5shiv.js"></script>
    <![endif]--> 
    <link href="BootCommerce%20Demo_files/general-style.css" rel="stylesheet">       
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="include/img/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="include/img/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="include/img/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="include/img/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="include/img/ico/apple-touch-icon-57-precomposed.png">
    <!--[if lt IE 9]>
        <script src="include/js/html5shiv.js"></script>
    <![endif]--> 
    <link href="BootCommerce%20Demo_files/slideshow.css" rel="stylesheet">  
  </head>  
  
  
  <body>
  <form action="save_shipping.php" >
  
   <div class="scroll_body_container"><!-- CONTAINER FOR NICESCROLL PLUGIN (FIX CHROME SCROLLING PROBLEM) this will be closed into footer.php file -->
<section class="container-fluid" id="top-bar"> <!-- CONTAINER -->
  <div class="container-semifluid">
    <div class="row-fluid">
         <div class="span7">
           
       <div class="span1 text-right">
      	 <select style="width: 0px; height: 0px; outline: medium none; padding: 0px; margin: 0px; opacity: 0;" id="default_client_language" class="change_language_on_the_fly bootstyl text-left solid unbordered"  data-verse="right">
  <option data-img-before="&lt;img src=&quot;lang/en_US/en_US.png&quot; style=&quot;margin-right:10px;&quot; /&gt;" value="en_US" selected="selected"></option><option data-img-before="&lt;img src=&quot;lang/it_IT/it_IT.png&quot; style=&quot;margin-right:10px;&quot; /&gt;" value="it_IT"></option></select>
       </div>
       <div class="span4">
		   <div class="row-fluid">
    <div class="span12 text-right">
           <ul class="nav topcart">
		   <style>
		   #qty{width:40%;}
		   
		   
		   #shopping-cart-btn, .shopping-cart-btn {
				margin: 10px 15px 5px 15px;
				}
				.btn-sm, .btn-group-sm>.btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-default {
color: #333 !important;
background-color: #fff !important;
border-color: #ccc !important;
}
.btn {
display: inline-block !important;
padding: 6px 12px !important;
margin-bottom: 0 !important;
font-size: 14px !important;
font-weight: 400 !important;
line-height: 1.42857143 !important;
text-align: center !important;
white-space: nowrap !important;
vertical-align: middle !important;
cursor: pointer !important;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
user-select: none;
background-image: none !important;
border: 1px solid transparent !important;
border-radius: 4px !important;
}
.glyphicon {
position: relative !important;
top: 1px !important;
display: inline-block !important;
font-family: 'Glyphicons Halflings' !important;
font-style: normal !important;
font-weight: 400 !important;
line-height: 1 !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
		   </style>
                <li class="dropdown">  
				<span class="dropdown-toggle" data-toggle="dropdown">				
				<a href="" class="shopping-cart-btn btn btn-default btn-sm navbar-right"><strong><?=$_SESSION['total_number'];?></strong> items of <strong><?=$_SESSION['subtotal'];?></strong> in your <i class="glyphicon glyphicon-shopping-cart"></i></a>              
				</span>
				   <ul class="dropdown-menu squared">
                        <li>
                            <table>
                                <tbody class="product-tbody-container">
								<?php $total_number1=0;
									$total_price1 =0;
								if(isset($_SESSION['cart']))
									{
										foreach($_SESSION['cart'] as $cart_id => $x)
										{ 

											$total_number1 = $total_number1 + $x['qty'];	
										
											$results = mysqli_query($con, "SELECT * from product WHERE ProductID=$cart_id");
											$result = mysqli_fetch_array($results);
											$PID1 = $result['ProductID'];
											$im = $result['SmallImage'];
											$total_price1 = $total_price1 + ($result['Price']* ($x['qty'] ? $x['qty'] : 1));
											if($PID1>12310)
											{
												$im= substr($im, 0, -4);
												$im="poster/".$im."_thumbnail.jpg";
											}
											else if($PID1<=12310)
											{
												$im="poster/".$im;
											}
								?>
									<tr>
									  <td class="image">
									   <img class="lazy" data-original="http://q8movies.com/<?=$im;?>" src="http://q8movies.com/<?=$im;?>" alt="fast and furious 6" style="display: inline;">
									  </td>
									  <td class="name">
										<a href=""><?=$_SESSION['ProductName'];?></a><br>
										<strong><?=$total_number1;?></strong> x <?=$total_price1;?>
										
									  </td>  							                                
									  <td class="remove"><a href="?id=<?=$result['ProductID'];?>&action=remove"><span class="btn btn-danger btn-mini remove-from-cart tooltiped" title="Remove from Cart" data-options-item="be832" data-id-item="12804"><i class="icon-white icon-trash"></i></span></a></td>
									</tr>   
								<?php } } ?>
								</tbody>
                            </table>
                                                        
							<table>
                                <tbody class="counts-container">
                                    <tr>
                                        <td class="text-right"><strong>Subtotal:</strong></td>
                                        <td class="text-right subtotal"><?=$_SESSION['subtotal'];?></td>
                                    </tr>
                                    <tr>
                                        <td class="text-right"><strong>Vat:</strong></td>
                                        <td class="text-right tax">4.23</td>
                                    </tr>
									                                    
                                    <tr>
                                        <td class="text-right"><strong>Total:</strong></td>
                                        <td class="text-right total"><?php echo $_SESSION['subtotal']+4.23;?></td>
                                    </tr>
                                </tbody>
                            </table>
                                                       <div class="text-center cart-options-container"> <a class="btn btn-info squared solid unbordered" href="">Cart</a> <a class="btn btn-primary squared solid unbordered" href="">Checkout</a> </div>
                        </li>
                    </ul>
                </li>
            </ul>    
    </div>
  </div>       </div>
    </div>
  </div>
</section>

<div class="clearfix"></div>    
   <section class="container-semifluid" id="main-container"> <!-- CONTAINER -->     
           <div class="row-fluid" style="position:relative;">
        
        <span style="left: 192px; width: 0px;" class="categories_menu_indicator"></span>       
       </div> 
	<section class="row-fluid cart-page" style="margin-right:auto;margin-left:auto;width:70%;"><!-- BODY ROW -->               
	    <section class="span12 cart-container"> 
		      <?php  if(count($_SESSION['cart']) == 0){?>
              <div class="alert-cart-container row-fluid">
                <div class="span12">
                   <div class="alert alert-warning alert-block squared solid unbordered"><h4>CAUTION!!!<br><br> Your cart is empty</h4></div>
                    <br>
                    <a class="btn btn-info btn-large squared solid unbordered pull-right" href="http://grabwebs.com/commerce/grid.php">Return to Shopping</a>                   
                </div>
              </div>
			  <?php }?>
             <div class="products-list-div">                             
              <div class="row-fluid">
                <div class="span12" id="products-list-table">  
						<table class="table-striped table-condensed">
							<thead>
								<tr>
									<th>Image</th>
									<th>Name</th>
									<th class="numeric">Qty</th>
									<th class="numeric">Unit Price</th>
									<th class="numeric">Subtotal</th>
									<th class="numeric">Actions</th>
								</tr>
							</thead>
							<tbody class="product-tbody-container">
							<?php 
								$total_number=0;
								$total_price =0;
									if(isset($_SESSION['cart']))
									{
										foreach($_SESSION['cart'] as $cart_id => $x)
										{
											
											$total_number = $total_number + $x['qty'];	
											//$_SESSION['total_number'] = $total_number;
											$results = mysqli_query($con, "SELECT * from product WHERE ProductID=$cart_id");
											$result = mysqli_fetch_array($results);
											$PID1 = $result['ProductID'];
											$im = $result['SmallImage'];
											$total_price = $total_price + ($result['Price']* ($x['qty'] ? $x['qty'] : 1));
											if($PID1>12310)
											{
												$im= substr($im, 0, -4);
												$im="poster/".$im."_thumbnail.jpg";
											}
											else if($PID1<=12310)
											{
												$im="poster/".$im;
											}
							?>
							<tr>
	<td class="image" data-title="Image">
	 <img class="lazy" data-original="http://q8movies.com/<?=$im;?>" src="http://q8movies.com/<?=$im;?>" alt="Oblivion" style="display: inline;">
	</td>
	<td data-title="Name">
	  <p type="text" name="pname[]" readonly><?=$result['ProductName'];?></p>
												 
	</td> 
	
	<td data-title="Qty">
	<input type="number" name="quantity[]" id="qty" value="<?php if($_SESSION['cart'][$cart_id]['qty'] == ""){ echo "1";}else{echo $_SESSION['cart'][$cart_id]['qty'];}?>">
	 									                                           
	</td>  
	<td data-title="Unit Price"><span class="old-price-container"><?=$result['Price'];?></span> <span class="product-offer"></span>
	</td>
	<td data-title="Subtotal">
	  <?=$result['Price']* $_SESSION['cart'][$cart_id]['qty'] ? $_SESSION['cart'][$cart_id]['qty'] : 1;?>
	</td> 											   											                              
	<td class="remove" data-title="Actions">	
	  <a href="#" onclick="updatecart(<?=$result['ProductID'];?>);"><span class="btn btn-success btn-small update-cart tooltiped" title="Update" data-options-item="b879e" data-id-item="<?=$result['ProductID'];?>"><i class="icon-white icon-edit"></i></span></a>
	  <a href="#" onclick="removecart(<?=$result['ProductID'];?>);"><span class="btn btn-danger btn-small remove-from-cart tooltiped" title="Remove from Cart" data-options-item="b879e" data-id-item="<?=$result['ProductID'];?>"><i class="icon-white icon-trash"></i></span></a>
	</td>
</tr>
							<?php			}
									}
								
							?>
							</tbody>
						</table>
                </div>
              </div>
              <br>
              <div class="row-fluid">
                 <div class="span8"></div>
                 <div class="span4">
                                <span class="btn btn-info btn-large btn-block squared solid unbordered pull-right btn-refresh-cart"><i class="icon-white icon-refresh"></i> Update Cart</span>
                                <br><br><br>        
                                <table class="table table-hover table-striped pull-right">
                                    <tbody class="counts-container">
										<tr>
                                            <td><strong>Number of Products:</strong></td>
                                            <td class="subtotal"><?php $_SESSION['total_number'] = $total_number;
                                                          echo $total_number;?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Subtotal:</strong></td>
                                            <td class="subtotal"><?php 
											$_SESSION['subtotal'] = $total_price;
											echo $total_price;?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Vat:</strong></td>
                                            <td class="tax">4.23</td>
                                        </tr>
                                        <tr>
                                            <td><strong>Total:</strong></td>
                                            <td><?php echo $total_price+4.23;?></td>
                                        </tr>
                                    </tbody>
                                </table>
                                <div class="clearfix"></div>                          
                                <div class="row-fluid">
                                  <div class="span6 text-left">
                                    <a class="btn btn-info squared solid unbordered btn-block" href="index.php">Return to Shopping</a>
                                  </div>
                                  <div class="span6">
                                    <a class="btn btn-primary squared solid unbordered btn-block" href="vigsign.php?action=checkout">Checkout</a>
                                  </div>
                                </div>                                                            
                 </div>
              </div> 
             </div>        
       </section>                       
     </section>
 
<section class="span6 registration-container"> 
           <h3>enter the shipping address <?php echo $uName?></h3>
          
            <strong class="text-info"><small>Fields marked with (*) are required</small></strong>
			<br/>
           <div id="result-registration" class="alert alert-success"></div>
		   <br/>
          <div style="padding:15px;border:1px solid #fff;border-radius:6px;background:#e5e5e5" class="default-status-registration-form">
           <div class="container_form" style=" width: 496px; position: relative;">
		                <div class="container_steps" style="position: relative; width: 1488px; border: none; padding: 0px; margin: 0px;">
			 <div id="fstep_1" style="width: 496px; overflow: auto; border: none; padding: 0px; margin: 0px; float: left;">            
                 
				 <div class="row-fluid">
                    <div class="control-group span12 warning"><label calss="control-label" for="phone"><strong>Phone*</strong></label><div class="controls"><div class="input-prepend no-add row-fluid"><input type="text" class="required span12" name="phone" id="phone" value="<?php echo $mobile;?>" data-array="12,12,Phone*" placeholder="Phone*" autocomplete="off" style="width: 100%;"></div></div></div> 
                  </div>
				 <div class="row-fluid">  
                    <div class="control-group span12 warning">
					<label calss="control-label" for="name"><strong>First Name*</strong></label>
						<div class="controls">
							<div class="input-prepend no-add row-fluid">
								<input type="text" class="required span12" name="name" id="name" value="<?php echo $firstName;?>" data-array="12,12,Name*" placeholder="Name*" autocomplete="off" style="width: 100%;">
							</div>
							<label for='name' generated='true' class='error help-inline'></label>
						</div>
					</div>
                  </div>
                  
                  <div class="row-fluid">  
                    <div class="control-group span12 warning"><label calss="control-label" for="address"><strong>Area*</strong></label>
					<div class="controls"><div class="input-prepend no-add row-fluid">
					<input type="text" class="required span12" name="area" id="area" value="<?php echo $area;?>" data-array="12,12,Address*" placeholder="area*" autocomplete="off" style="width: 100%;"></div></div></div>
                  </div>
				  <div class="row-fluid">  
                    <div class="control-group span12 warning"><label calss="control-label" for="block"><strong>block*</strong></label>
					<div class="controls"><div class="input-prepend no-add row-fluid">
					<input type="text" class="required span12" name="block" id="block" value="<?php echo $block;?>" data-array="12,12,Address*" placeholder="block*" autocomplete="off" style="width: 100%;"></div></div></div>
                  </div>
				    
				   <div class="row-fluid">
                    <div class="control-group span12 warning"><label calss="control-label" for="jadda"><strong>jadda*</strong></label><div class="controls"><div class="input-prepend no-add row-fluid"><input type="text" class="required span12" name="jadda" id="jadda" value="<?php echo $jadda;?>" data-array="12,12,City*" placeholder="jadda*" autocomplete="off" style="width: 100%;"></div></div></div> 
                  </div> 
                  <div class="row-fluid">
                    <div class="control-group span12 warning"><label calss="control-label" for="houseno"><strong>house no*</strong></label><div class="controls"><div class="input-prepend no-add row-fluid"><input type="text" class="required span12" name="houseno" id="houseno" value="<?php echo $houseno;?>" data-array="12,12,Zip Code*" placeholder="houseno*" autocomplete="off" style="width: 100%;"></div></div></div> 
                  </div>
				  <div class="row-fluid">
                    <div class="control-group span12 warning"><label calss="control-label" for="landmark"><strong>landmark</strong></label><div class="controls"><div class="input-prepend no-add row-fluid"><input type="text" class="required span12" name="landmark" id="landmark" value="<?php echo $landmark;?>" data-array="12,12,City*" placeholder="landmark" autocomplete="off" style="width: 100%;"></div></div></div> 
                  </div>
				 	  
                 
             </div>
			 </div>
              <input type="submit" value="NEXT" name="save_shipping">
                                  
           	   </div>          
           
          </div>
           </section>
   </section>
   </section>

</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
 <script>
	function removecart(id){
		$.ajax({
			url:'cart-control.php?action=remove',
			type:'post',
			data: 'id='+id,
			beforeSend:function(){
				$('#more_popup').html('<div class="error" style="padding:30px;"><img  src="BootCommerce Demo_files/loader.gif" alt="Loading..." align="middle"/></div>');       
			},
			success:function(data){
	
				location.reload();
			}
		});
	}	
	function updatecart(id){
		var qty = $("#qty").val();
		$.ajax({
			url:'cart-control.php?action=update&qty='+qty,
			type:'post',
			data: 'id='+id,
			beforeSend:function(){
				$('#more_popup').html('<div class="error" style="padding:30px;"><img  src="BootCommerce Demo_files/loader.gif" alt="Loading..." align="middle"/></div>');       
			},
			success:function(data){
		
				location.reload();
			}
		});
	}
 </script>
<?php
}
else{
require("include/connect.php"); 
 print '<script type="text/javascript">alert("plese add more 3 or more products for check out");</script>';

?>

 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>BootCommerce Demo</title>    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="BootCommerce is an E-commerce solution based on twitter bootstrap,perfect for any kind of shops.A complete Control Panel to manage Products, Categories, Orders,Clients and many system options">
    <meta name="keywords" content="e-commerce,ecommerce,bootstrap,twitter shop,shop,online sell,envato,codecanyon,template shop">
    <meta name="robots" content="INDEX,FOLLOW">
    <meta name="viewport" content="user-scalable=no,initial-scale=1.0, maximum-scale=1.0 width=device-width">
    <!-- Styles -->
    	 
	<link href="BootCommerce%20Demo_files/bootstrap.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/bootstrap_extensions.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/addons.css" rel="stylesheet">   
	<link href="BootCommerce%20Demo_files/bootstrap-responsive.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/bootstrap_responsive_extensions.css" rel="stylesheet">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="include/js/html5shiv.js"></script>
    <![endif]--> 
    <link href="BootCommerce%20Demo_files/general-style.css" rel="stylesheet">       
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="include/img/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="include/img/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="include/img/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="include/img/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="include/img/ico/apple-touch-icon-57-precomposed.png">
    <!--[if lt IE 9]>
        <script src="include/js/html5shiv.js"></script>
    <![endif]--> 
    <link href="BootCommerce%20Demo_files/slideshow.css" rel="stylesheet">  
  </head>  
  
  
  <body>
  <form action="save_shipping.php" >
  
   <div class="scroll_body_container"><!-- CONTAINER FOR NICESCROLL PLUGIN (FIX CHROME SCROLLING PROBLEM) this will be closed into footer.php file -->
<section class="container-fluid" id="top-bar"> <!-- CONTAINER -->
  <div class="container-semifluid">
    <div class="row-fluid">
         <div class="span7">
           
       <div class="span1 text-right">
      	 <select style="width: 0px; height: 0px; outline: medium none; padding: 0px; margin: 0px; opacity: 0;" id="default_client_language" class="change_language_on_the_fly bootstyl text-left solid unbordered"  data-verse="right">
  <option data-img-before="&lt;img src=&quot;lang/en_US/en_US.png&quot; style=&quot;margin-right:10px;&quot; /&gt;" value="en_US" selected="selected"></option><option data-img-before="&lt;img src=&quot;lang/it_IT/it_IT.png&quot; style=&quot;margin-right:10px;&quot; /&gt;" value="it_IT"></option></select>
       </div>
       <div class="span4">
		   <div class="row-fluid">
    <div class="span12 text-right">
           <ul class="nav topcart">
		   <style>
		   #qty{width:20%;}
		   #shopping-cart-btn, .shopping-cart-btn {
				margin: 10px 15px 5px 15px;
				}
				.btn-sm, .btn-group-sm>.btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-default {
color: #333 !important;
background-color: #fff !important;
border-color: #ccc !important;
}
.btn {
display: inline-block !important;
padding: 6px 12px !important;
margin-bottom: 0 !important;
font-size: 14px !important;
font-weight: 400 !important;
line-height: 1.42857143 !important;
text-align: center !important;
white-space: nowrap !important;
vertical-align: middle !important;
cursor: pointer !important;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
user-select: none;
background-image: none !important;
border: 1px solid transparent !important;
border-radius: 4px !important;
}
.glyphicon {
position: relative !important;
top: 1px !important;
display: inline-block !important;
font-family: 'Glyphicons Halflings' !important;
font-style: normal !important;
font-weight: 400 !important;
line-height: 1 !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
		   </style>
                <li class="dropdown">  
				<span class="dropdown-toggle" data-toggle="dropdown">				
				<a href="" class="shopping-cart-btn btn btn-default btn-sm navbar-right"><strong><?=$_SESSION['total_number'];?></strong> items of <strong><?=$_SESSION['subtotal'];?></strong> in your <i class="glyphicon glyphicon-shopping-cart"></i></a>              
				</span>
				   <ul class="dropdown-menu squared">
                        <li>
                            <table>
                                <tbody class="product-tbody-container">
								<?php $total_number1=0;
									$total_price1 =0;
								if(isset($_SESSION['cart']))
									{
										foreach($_SESSION['cart'] as $cart_id => $x)
										{ 

											$total_number1 = $total_number1 + $x['qty'];	
										
											$results = mysqli_query($con, "SELECT * from product WHERE ProductID=$cart_id");
											$result = mysqli_fetch_array($results);
											$PID1 = $result['ProductID'];
											$im = $result['SmallImage'];
											$total_price1 = $total_price1 + ($result['Price']* ($x['qty'] ? $x['qty'] : 1));
											if($PID1>12310)
											{
												$im= substr($im, 0, -4);
												$im="poster/".$im."_thumbnail.jpg";
											}
											else if($PID1<=12310)
											{
												$im="poster/".$im;
											}
								?>
									<tr>
									  <td class="image">
									   <img class="lazy" data-original="http://q8movies.com/<?=$im;?>" src="http://q8movies.com/<?=$im;?>" alt="fast and furious 6" style="display: inline;">
									  </td>
									  <td class="name">
										<a href=""><?=$_SESSION['ProductName'];?></a><br>
										<strong><?=$total_number1;?></strong> x <?=$total_price1;?>
										
									  </td>  							                                
									  <td class="remove"><a href="?id=<?=$result['ProductID'];?>&action=remove"><span class="btn btn-danger btn-mini remove-from-cart tooltiped" title="Remove from Cart" data-options-item="be832" data-id-item="12804"><i class="icon-white icon-trash"></i></span></a></td>
									</tr>   
								<?php } } ?>
								</tbody>
                            </table>
                                                        
							<table>
                                <tbody class="counts-container">
                                    <tr>
                                        <td class="text-right"><strong>Subtotal:</strong></td>
                                        <td class="text-right subtotal"><?=$_SESSION['subtotal'];?></td>
                                    </tr>
                                    <tr>
                                        <td class="text-right"><strong>Vat:</strong></td>
                                        <td class="text-right tax">4.23</td>
                                    </tr>
									                                    
                                    <tr>
                                        <td class="text-right"><strong>Total:</strong></td>
                                        <td class="text-right total"><?php echo $_SESSION['subtotal']+4.23;?></td>
                                    </tr>
                                </tbody>
                            </table>
                                                       <div class="text-center cart-options-container"> <a class="btn btn-info squared solid unbordered" href="">Cart</a> <a class="btn btn-primary squared solid unbordered" href="">Checkout</a> </div>
                        </li>
                    </ul>
                </li>
            </ul>    
    </div>
  </div>       </div>
    </div>
  </div>
</section>

<div class="clearfix"></div>    
   <section class="container-semifluid" id="main-container"> <!-- CONTAINER -->     
           <div class="row-fluid" style="position:relative;">
        
        <span style="left: 192px; width: 0px;" class="categories_menu_indicator"></span>       
       </div> 
	<section class="row-fluid cart-page" style="margin-right:auto;margin-left:auto;width:70%;"><!-- BODY ROW -->               
	    <section class="span12 cart-container"> 
		      <?php  if(count($_SESSION['cart']) == 0){?>
              <div class="alert-cart-container row-fluid">
                <div class="span12">
                   <div class="alert alert-warning alert-block squared solid unbordered"><h4>CAUTION!!!<br><br> Your cart is empty</h4></div>
                    <br>
                    <a class="btn btn-info btn-large squared solid unbordered pull-right" href="http://grabwebs.com/commerce/grid.php">Return to Shopping</a>                   
                </div>
              </div>
			  <?php }?>
             <div class="products-list-div">                             
              <div class="row-fluid">
                <div class="span12" id="products-list-table">  
						<table class="table-striped table-condensed">
							<thead>
								<tr>
									<th>Image</th>
									<th>Name</th>
									<th class="numeric">Qty</th>
									<th class="numeric">Unit Price</th>
									<th class="numeric">Subtotal</th>
									<th class="numeric">Actions</th>
								</tr>
							</thead>
							<tbody class="product-tbody-container">
							<?php 
								$total_number=0;
								$total_price =0;
									if(isset($_SESSION['cart']))
									{
										foreach($_SESSION['cart'] as $cart_id => $x)
										{
											
											$total_number = $total_number + $x['qty'];	
											//$_SESSION['total_number'] = $total_number;
											$results = mysqli_query($con, "SELECT * from product WHERE ProductID=$cart_id");
											$result = mysqli_fetch_array($results);
											$PID1 = $result['ProductID'];
											$im = $result['SmallImage'];
											$total_price = $total_price + ($result['Price']* ($x['qty'] ? $x['qty'] : 1));
											if($PID1>12310)
											{
												$im= substr($im, 0, -4);
												$im="poster/".$im."_thumbnail.jpg";
											}
											else if($PID1<=12310)
											{
												$im="poster/".$im;
											}
							?>
							<tr>
	<td class="image" data-title="Image">
	 <img class="lazy" data-original="http://q8movies.com/<?=$im;?>" src="http://q8movies.com/<?=$im;?>" alt="Oblivion" style="display: inline;">
	</td>
	<td data-title="Name">
	  <input type="text"   value="<?=$result['ProductName'];?>" name="pname[]" readonly>   
												 
	</td> 
	
	<td data-title="Qty">
	<input type="number" name="quantity[]" id="qty" value="<?php if($_SESSION['cart'][$cart_id]['qty'] == ""){ echo "1";}else{echo $_SESSION['cart'][$cart_id]['qty'];}?>">
	 									                                           
	</td>  
	<td data-title="Unit Price"><span class="old-price-container"><?=$result['Price'];?></span> <span class="product-offer"></span>
	</td>
	<td data-title="Subtotal">
	  <?=$result['Price']* $_SESSION['cart'][$cart_id]['qty'] ? $_SESSION['cart'][$cart_id]['qty'] : 1;?>
	</td> 											   											                              
	<td class="remove" data-title="Actions">	
	  <a href="#" onclick="updatecart(<?=$result['ProductID'];?>);"><span class="btn btn-success btn-small update-cart tooltiped" title="Update" data-options-item="b879e" data-id-item="<?=$result['ProductID'];?>"><i class="icon-white icon-edit"></i></span></a>
	  <a href="#" onclick="removecart(<?=$result['ProductID'];?>);"><span class="btn btn-danger btn-small remove-from-cart tooltiped" title="Remove from Cart" data-options-item="b879e" data-id-item="<?=$result['ProductID'];?>"><i class="icon-white icon-trash"></i></span></a>
	</td>
</tr>
							<?php			}
									}
								
							?>
							</tbody>
						</table>
                </div>
              </div>
              <br>
              <div class="row-fluid">
                 <div class="span8"></div>
                 <div class="span4">
                                <span class="btn btn-info btn-large btn-block squared solid unbordered pull-right btn-refresh-cart"><i class="icon-white icon-refresh"></i> Update Cart</span>
                                <br><br><br>        
                                <table class="table table-hover table-striped pull-right">
                                    <tbody class="counts-container">
										<tr>
                                            <td><strong>Number of Products:</strong></td>
                                            <td class="subtotal"><?php $_SESSION['total_number'] = $total_number;
                                                          echo $total_number;?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Subtotal:</strong></td>
                                            <td class="subtotal"><?php 
											$_SESSION['subtotal'] = $total_price;
											echo $total_price;?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Vat:</strong></td>
                                            <td class="tax">4.23</td>
                                        </tr>
                                        <tr>
                                            <td><strong>Total:</strong></td>
                                            <td><?php echo $total_price+4.23;?></td>
                                        </tr>
                                    </tbody>
                                </table>
                                <div class="clearfix"></div>                          
                                <div class="row-fluid">
                                  <div class="span6 text-left">
                                    <a class="btn btn-info squared solid unbordered btn-block" href="index.php">Return to Shopping</a>
                                  </div>
                                  <div class="span6">
                                    <a class="btn btn-primary squared solid unbordered btn-block" href="vigsign.php?action=checkout">Checkout</a>
                                  </div>
                                </div>                                                            
                 </div>
              </div> 
             </div>        
       </section>                       
     </section>
	 </form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
 <script>
	function removecart(id){
		$.ajax({
			url:'cart-control.php?action=remove',
			type:'post',
			data: 'id='+id,
			beforeSend:function(){
				$('#more_popup').html('<div class="error" style="padding:30px;"><img  src="BootCommerce Demo_files/loader.gif" alt="Loading..." align="middle"/></div>');       
			},
			success:function(data){
	
				location.reload();
			}
		});
	}	
	function updatecart(id){
		var qty = $("#qty").val();
		$.ajax({
			url:'cart-control.php?action=update&qty='+qty,
			type:'post',
			data: 'id='+id,
			beforeSend:function(){
				$('#more_popup').html('<div class="error" style="padding:30px;"><img  src="BootCommerce Demo_files/loader.gif" alt="Loading..." align="middle"/></div>');       
			},
			success:function(data){
		
				location.reload();
			}
		});
	}
 </script>
<?php
}
?>

</body>
</html>